Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug from issue #460 #464

Merged
merged 5 commits into from
Mar 5, 2019
Merged

fix bug from issue #460 #464

merged 5 commits into from
Mar 5, 2019

Conversation

dimensi
Copy link
Contributor

@dimensi dimensi commented Feb 28, 2019

I found an #460 with a bug, since the bug is simple, I decided to correct the error.
The error was that we did not take into account the case when there is a node and there is no timeout.
I also set the enter and exit values in prop-types as reqiured.

@dimensi
Copy link
Contributor Author

dimensi commented Mar 5, 2019

@jquense ?

@silvenon
Copy link
Collaborator

silvenon commented Mar 5, 2019

Reviewing your PR now. 👀

Copy link
Collaborator

@silvenon silvenon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give more details about what your tests are proving? By "at once" do you mean "immediately"? How is time measured here?

I was thinking that actually 0 does make sense as a default timeout value for enter and exit. I think this would be the most logical step forward and wouldn't cause warnings for existing code. What do you think?

If you agree, would you mind reverting the change for prop types and instead of current tests add simpler tests where by measuring time you ensure that:

  1. in the absence of enter, the status upon entering immediately becomes entered
  2. in the absence of exit, the status upon exiting immediately becomes exited

I don't think we have to test the unmountOnExit prop for this, we just want to ensure the default values.

@silvenon
Copy link
Collaborator

silvenon commented Mar 5, 2019

Concerning prop types, you can take this opportunity to actually fix them:

PropTypes.oneOfType([
  PropTypes.number,
  PropTypes.shape({
    enter: PropTypes.number,
    exit: PropTypes.number,
    appear: PropTypes.number,
  })
]).isRequired

By moving isRequired to the correct place (at the end of oneOfType instead of shape), people who forget to add the timeout prop will finally get a warning.

I'm honestly not sure what isRequired does within oneOfType 🤔

Copy link
Collaborator

@silvenon silvenon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the summary of requested changes. Sorry for so many comments, it's a bit confusing because changes themselves are overlapping. 😅

src/Transition.js Outdated Show resolved Hide resolved
src/utils/PropTypes.js Outdated Show resolved Hide resolved
test/Transition-test.js Outdated Show resolved Hide resolved
src/Transition.js Outdated Show resolved Hide resolved
@dimensi
Copy link
Contributor Author

dimensi commented Mar 5, 2019

Could you give more details about what your tests are proving? By "at once" do you mean "immediately"? How is time measured here?

yes, i don't know english, i use google translate for find a word.

@silvenon silvenon merged commit 3a4cf9c into reactjs:master Mar 5, 2019
@silvenon
Copy link
Collaborator

silvenon commented Mar 5, 2019

Awesome, thank you! 🏆

@dimensi
Copy link
Contributor Author

dimensi commented Mar 5, 2019

@silvenon thx for your review. Are you sure my tests right writed?

@dimensi dimensi deleted the issues/460 branch March 5, 2019 14:03
@silvenon
Copy link
Collaborator

silvenon commented Mar 5, 2019

@dimensi yep, they look good to me. I didn't even think to combine both functionalities in the same test. We might later split that into two tests because they are two different features.

@jquense
Copy link
Collaborator

jquense commented Mar 14, 2019

🎉 This PR is included in version 2.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants